#include "GlobalDefinition.h"
#include <string>
#include <io.h>
#include <ctime>

using namespace std;
const unsigned int DATETIME_LENGTH = 14;

#pragma once

/************************************************************************/
/* DateTime Format : YYYYMMDDHHMMSS                                     */
/************************************************************************/
class DateTime
{
public:
	DateTime();
	DateTime(char* p_DateTime, unsigned int p_uiLength);
	DateTime(string p_strDateTime);
	static string GetLocalDate();
	static string GetLocalTime();
	static string GetLocalDateTime();
	static bool IsWeekend();
	string DateToString();
	string TimeToString();
	string DateTimeToString();
	void SetToCurrentDateTime();
	void SetToCurrentDate();
	void SetToCurrentTime();
	void SetDateTime(string p_strDateTime);
	unsigned int GetYear();
	unsigned int GetMonth();
	unsigned int GetDay();

	unsigned int operator - (const DateTime& p_crRight);

private:
	void SetValue(char* p_szSourceBuffer,unsigned int& p_uiDestValue,unsigned int p_uiSize);

private:
	unsigned int m_uiYear;
	unsigned int m_uiMonth;
	unsigned int m_uiDay;
	unsigned int m_uiHour;
	unsigned int m_uiMinute;
	unsigned int m_uiSecond;
	char m_szBuffer[DATETIME_LENGTH];
};